<?php //        
//$result = $dbfunc->query("SELECT *,tb_job.* FROM tb_student 
//        LEFT JOIN tb_reg ON tb_student.student_id = tb_reg.student_id 
//        NATURAL JOIN tb_sec NATURAL JOIN tb_subject 
//        NATURAL JOIN tb_job 
//        LEFT JOIN tb_jobsend ON tb_jobsend.job_id = tb_job.sec_id
//        WHERE tb_student.student_id='{$_SESSION['sess_userid']}' AND
//        jobsend_id IS NULL
//        
//        UNION
//        
//        SELECT *,tb_job.* FROM tb_student 
//        LEFT JOIN tb_plan ON tb_student.room_id = tb_plan.room_id
//        NATURAL JOIN tb_sec NATURAL JOIN tb_subject 
//        NATURAL JOIN tb_job 
//        LEFT JOIN tb_jobsend ON tb_jobsend.job_id = tb_job.sec_id
//        WHERE tb_student.student_id='{$_SESSION['sess_userid']}' AND
//        jobsend_id IS NULL
//        "
//        );

$stu_regis = array();

$result = $dbfunc->query("SELECT *,tb_jobsend.* FROM tb_teacher 
        NATURAL JOIN tb_sec 
        NATURAL JOIN tb_job 
        NATURAL JOIN tb_jobsend 
        NATURAL JOIN tb_student 
        WHERE tb_teacher.teacher_id = '{$_SESSION['sess_userid']}' AND (jobsend_score IS NULL OR jobsend_score = '')");
$job_arr = array();
while($item = mysql_fetch_assoc($result)){
    $job_arr[] = $item;
}
//echo "<pre>";
//print_r($job_arr);
//echo "</pre>";
?>

<div align="center">
    <div>เลือกไฟล์เพื่อส่งงาน</div>
    <table border="1">
        <tr>
            <td>ชั้นเรียน</td>
        </tr>
        <?php
        foreach($job_arr as $key => $value){            
            echo "<tr>";
            echo "<td><form action=\"index.php?module=admin&page=jobsend_inpoint\" method=\"post\">".$value['student_name']." ".$value['student_surname']."(".$value['job_name'].") : <input type=\"hidden\" value=\"{$value['jobsend_id']}\" name=\"jobsend_id\" /><input type=\"text\" name=\"score\" /><input type=\"submit\" value=\"ตกลง\" /> <a href=\"jobsend/{$value['jobsend_file']}\">ไฟล์งาน</a></form></td>";
            echo "</tr>";
        }
        ?>
    </table>
</div>